<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <title>Create Course</title>
    </h:head>
    <h:body>
        <h:message style="color: red" for="form"/>
        <h:form id="form" enctype="multipart/form-data">
            <h:dataTable value="#{courseBean.courseClasses}" var="course">
                <h:column>
                    <f:facet name="header">Name</f:facet>
                    <h:inputText id="name" required="true" value="#{course.coursename}"></h:inputText>
                </h:column>
                <h:column>
                    <f:facet name="header">Identifier</f:facet>
                    <h:inputText id="identifier" value="#{course.identifier}" disabled="true"></h:inputText>
                </h:column>
                <h:column>
                    <f:facet name="header">Course Coordinator</f:facet>
                    <h:inputText id="coursecoordinator" required="true" value="#{course.coursecoordinator}"></h:inputText>
                </h:column>
                <h:column>
                    <f:facet name="header">Degree Programs</f:facet>
                    <h:selectManyCheckbox value="#{course.ownDegreePrograms}">
                        <f:selectItems value="#{course.allDegreePrograms}" var="dp"
                                       itemLabel="#{dp}" itemValue="#{dp}" />
                    </h:selectManyCheckbox>
                </h:column>
                <h:column>
                    <f:facet name="header">Course Outcomes</f:facet>
                    <h:selectManyCheckbox value="#{course.ownCourseOutcomes}">
                        <f:selectItems value="#{course.allCourseOutcomes}" var="co"
                                       itemLabel="#{co}" itemValue="#{co}" />
                    </h:selectManyCheckbox>
                </h:column>
                <h:column>
                    <f:facet name="header">Alternate Course Coordinators</f:facet>
                    <h:selectManyCheckbox value="#{course.ownAltCourseCoordinators}">
                        <f:selectItems value="#{course.allAltCourseCoordinators}" var="alt"
                                       itemLabel="#{alt}" itemValue="#{alt}" />
                    </h:selectManyCheckbox>
                </h:column>
            </h:dataTable>
            <h:commandButton id='submit' value="Submit" action="#{courseBean.saveEntry()}" />
        </h:form>
    </h:body>
</html>

